import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str1=sc.nextLine();
        String str2=sc.nextLine();
        String str3="";
        char[] ch=new char[str1.length()];
        for(int i=0;i<str1.length();i++){
            ch[i]=str1.charAt(i);
            if(!str2.contains(String.valueOf(ch[i]))){
                str3=str3.concat(String.valueOf(ch[i]));
            }
        }
        System.out.println(str3);
    }
    public static void main3(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        Stack<Integer> stack=new Stack<>();
        for(int i=0;i<n;i++){
            for(int j=2;j<=arr[i];j++){
                if(arr[i]%j==0&&func(j)){
                    stack.push(j);
                }
            }
        }
        int sum=0;
        while(!stack.isEmpty()){
            int res=stack.pop();
            if(res!=stack.peek()){
                sum+=res;
            }
        }
    }
    public static boolean func(int num){
        for(int i=2;i<Math.sqrt(num);i++){
            if(num%i==0) return false;
        }
        return true;
    }
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        int min=arr[1]-arr[0];
        for(int i=1;i<n-1;i++){
            if(min>arr[i+1]-arr[i]){
                min=arr[i+1]-arr[i];
            }
        }
        System.out.println(min);
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        String str1=sc.nextLine();
        System.out.println(str+str1);
    }
}